package com.srd.phone.bean;


import com.srd.phone.utils.CommonUtils;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public class HPayment {

    public int id;
    public int uid;
    public int num;
    public String ptime;
    public double monrey;
    public String numbersm;
    public String bnm;
    public String pstatem;

    public static List<HPayment> parseData(String json){

        List<HPayment> list = new ArrayList<HPayment>();
        try {
            JSONArray jsonArray = new JSONArray(json);
            for (int i = 0; i < jsonArray.length(); i++) {
                HPayment item = new HPayment();
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                item.bnm = jsonObject.optString("bnm");
                item.monrey = jsonObject.optDouble("monrey",0);
                item.numbersm = jsonObject.optString("numbersm");
                item.num = jsonObject.optInt("num");
                item.ptime = CommonUtils.formatDataStr(jsonObject.optString("ptime"));
                list.add(item);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return list;
    }
}
